<!DOCTYPE html >
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的发布</title>
</head>
<body>
<style type="text/css">
*{
	margin:0;
	padding:0;
	list-style-type:none;
}
a, img{
	border:0;
}
body{
	font:12px/180% Arial, Helvetica, sans-serif, "新宋体";
	color:#333;
}
a{
	text-decoration:none;
	color:#333;
	-webkit-transition:color .2s;
	-moz-transition:color .2s;
	-o-transition:color .2s;
	-ms-transition:color .2s;
	transition:color .2s;}
a:hover{
	text-decoration:underline;
	color:#ff7d8e;
}
a:focus{
	outline:none;
}
.brand-list{
	width:1272px;
	margin:0 auto;
}
.brand-list .item{
	position:absolute;
	width:377px;
	background:url(images/132.gif) no-repeat center center;
	top:0;
	left:40%;
	-webkit-transition:all 0.3s;
	-moz-transition:all 0.3s;
	-o-transition:all 0.3s;
	-ms-transition:all 0.3s;
	transition:all 0.3s;
}

.brand-list .additem{
	width:377px;
	border:none;
}

.brand-list .item h3{
	font-size:42px;
	color:#666;
	font-family:arial;
	font-size:18px;
	font-weight:800;
	line-height:.8;
	margin-bottom:20px;
}

.brand-list .item p{
	margin-bottom:15px;
}

.boxgrid{
	width:377px;
	height:227px;
	overflow:hidden;
	position:relative;
}

.boxgridq{
	width:377px;
	height:488px;
	overflow:hidden;
	position:relative;
}

.item .boxgrid h3{
	margin:10px 0px 10px 0px;
	color:#FFF;
	font:24pt 微软雅黑, sans-serif;
	letter-spacing:-1px;
	font-weight:bold;
	text-align:center;
}

.boxgrid img{
	position:absolute;
	top:0;
	left:0;
	border:0;
}

.boxgrid p{
	color:#afafaf;
	font-weight:bold;
	text-align:center;
}	

.boxgrid p a{
	text-decoration:none;
	color:#FFF;
	font-family:微软雅黑;
	font-size:12px;
}

.boxcaption{
	float:left;
	position:absolute;
	background:url(images/28.png);
	height:200px;
	width:100%;
}

.boxcaptiona{
	float:left;
	position:absolute;
	background:url(images/28.png);
	height:200px;
	width:100%;
}

.caption .boxcaption{
	top:165px;
	left:0px;
}

.captiona .boxcaptiona{
	top:427px;
	left:0px;
}


</style>


<div style="width:1272px;position:relative;left:50%;margin-left:-586px;">
	<div class="brand-list" id="brand-waterfall">
		<div class="item">
			<div class="boxgrid caption">
				<img src="images/pic2.jpg"/>
				<div class="cover boxcaption">
					<h3>65.00元 </h3>
					<p><a href="https://detail.tmall.com/item.htm?id=541413373215&ali_trackid=2:mm_126614321_37080807_145748672:1509532195_374_614569409&spm=a311n.8189758/a.90200000.1.5cf16703XHEbOr&sku_properties=20509:28383">秋冬韩版宽松吊带裙女中长款纯色毛衣裙衣服女装厚背带裙连衣裙潮</a></p>
				</div>
			</div>
		</div>

		

		<div class="item">
			<div class="boxgrid captiona boxgridq">
				<img src="images/pic1.jpg"/>
				<div class="cover boxcaptiona">
					<h3>488.00元 </h3>
					<p><a href="https://item.taobao.com/item.htm?id=557849041393&ali_refid=a3_430639_1007:1102178814:N:50005065_0_100:63073aca9efe05b7010daa37a52ea60d&ali_trackid=1_63073aca9efe05b7010daa37a52ea60d&spm=a231o.7076277.1999015184.23">思美人 颜色的店原创设计秋装新款羊绒针织加蕾丝旗袍 定制款</a></p>
				</div>
			</div>
		</div> 
		
		<div class="item">
			<div class="boxgrid caption">
				<img src="images/pic5.jpg"/>
				<div class="cover boxcaption">
					<h3> 89.00元</h3>
					<p><a href="https://item.taobao.com/item.htm?id=555625872007&ali_trackid=2:mm_126614321_37080807_145748672:1509530533_331_1908749251&spm=a311n.8189758%2Fa.90200000.1.2e192e3eBndIzT">韩版ulzzang运动鞋女鞋学生潮2017秋百搭原宿风休闲跑步鞋子平底</a></p>
				</div>
			</div>
		</div>

		

		<div class="item">
			<div class="boxgrid caption">
				<img src="images/pic6.jpg"/>
				<div class="cover boxcaption">
					<h3>30.80元 </h3>
					<p><a href="https://item.taobao.com/item.htm?id=559772123078&ali_trackid=2:mm_126614321_37080807_145748672:1509530812_373_314384534&spm=a231o.7076277.20003.17&pvid=200_11.179.136.122_167595_1509528571764#">秋冬季polo学院风拼接绣花时尚宽松长袖连帽加绒卫衣学生外套女潮</a></p>
				</div>
			</div>
		</div>		

		<div class="item">
			<div class="boxgrid captiona boxgridq">
				<img src="images/pic3.jpg"/>
				<div class="cover boxcaptiona">
					<h3>99.00元 </h3>
					<p><a href="https://detail.tmall.com/item.htm?id=557855686095&ali_trackid=2:mm_126614321_37080807_145748672:1509529909_308_663840633&spm=a231o.7712113/f.1004.59&pvid=200_10.184.82.32_167575_1509528834458">西服套装男修身西装男大学生商务上班面试职业装正装伴郎团礼服装</a></p>
				</div>
			</div>
		</div>	

		<div class="item">
			<div class="boxgrid captiona boxgridq">
				<img src="images/pic4.jpg"/>
				<div class="cover boxcaptiona">
					<h3>¥14.80-34.80 </h3>
					<p><a href="https://item.taobao.com/item.htm?id=528039067333&ali_trackid=2:mm_126614321_37080807_145748672:1509529984_386_319707316&spm=a231o.7712113%2Ff.1004.1&pvid=200_11.224.194.115_303_1509529975887">万圣节儿童服装女巫披风斗篷成人男巫婆衣服男童cospaly巫师袍 女</a></p>
				</div>
			</div>
		</div>
	</div>

</div>



<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$('.boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'120px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'165px'},{queue:false,duration:160});
	});
	$('.boxgrid.captiona').hover(function(){
		$(".cover", this).stop().animate({top:'378px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'427px'},{queue:false,duration:160});
	});
});
</script>

<script type="text/javascript">
$(function(){
	$('#brand-waterfall').waterfall();
});


;(function ($) {
    $.fn.waterfall = function(options) {
        var df = {
            item: '.item',
            margin: 30,
            addfooter: true
        };
        options = $.extend(df, options);
        return this.each(function() {
            var $box = $(this), pos = [],
            _box_width = $box.width(),
            $items = $box.find(options.item),
            _owidth = $items.eq(0).outerWidth() + options.margin,
            _oheight = $items.eq(0).outerHeight() + options.margin,
            _num = Math.floor(_box_width/_owidth);
            (function() {
                var i = 0;
                for (; i < _num; i++) {
                   pos.push([i*_owidth,0]);
                } 
            })();

            $items.each(function() {
                var _this = $(this),
                _temp = 0,
                _height = _this.outerHeight() + options.margin;
                _this.hover(function() {
                    _this.addClass('hover');
                },function() {
                    _this.removeClass('hover');
                });

                for (var j = 0; j < _num; j++) {
                    if(pos[j][1] < pos[_temp][1]){
                        //暂存top值最小那列的index
                        _temp = j;
                    }
                }
                this.style.cssText = 'left:'+pos[_temp][0]+'px; top:'+pos[_temp][1]+'px;';
                //插入后，更新下该列的top值
                pos[_temp][1] = pos[_temp][1] + _height;
            });
            // 计算top值最大的赋给外围div
            (function() {
                var i = 0, tops = [];
                for (; i < _num; i++) {
                    tops.push(pos[i][1]);
                }
                tops.sort(function(a,b) {
                    return a-b;
                });
                $box.height(tops[_num-1]);
                //增加尾部填充div
                if(options.addfooter){
                    addfooter(tops[_num-1]);
                }

            })();
            function addfooter(max) {
                var addfooter = document.createElement('div');
                addfooter.className = 'item additem';
                for (var i = 0; i < _num; i++) {
                    if(max != pos[i][1]){
                        var clone = addfooter.cloneNode(),
                        _height = max - pos[i][1] - options.margin;
                        clone.style.cssText = 'left:'+pos[i][0]+'px; top:'+pos[i][1]+'px; height:'+_height+'px;';
                        $box[0].appendChild(clone);
                    }
                }
            }
        });
    }
})(jQuery);
</script>
</div>
</body>
</html>